package com.ss.android.article.base.feature.detail2.config;

import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.StateListDrawable;
import android.view.View;

import com.bytedance.article.b.a.GsonDependManager;
import com.bytedance.common.utility.Logger;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.feature.feed.FeedCellStyleConfig;

import java.io.Serializable;

public class DetailStyleConfig {
    public class DetailStyleConfigModel implements Serializable {
        public String[] comment_font_color;
        public int[] comment_font_size;
        public String[] comment_user_color;
        public int[] comment_user_font_size;
        public String[] detail_background_color;
        public String[] natant_background_color;
        public String[] natant_font_color;
        public int[] natant_font_size;
        public String[] sub_comment_background_color;
        public String[] sub_comment_font_color;
        public int[] sub_comment_font_size;
        public String[] sub_comment_more_color;
        public String[] sub_comment_user_color;
        public String[] video_related_font_color;
        public int video_related_font_size;
        public String[] video_title_font_color;
        public int video_title_font_size;

        public DetailStyleConfigModel() {

        }
    }

    private static String TAG;
    private static DetailStyleConfigModel mDetailStyleConfigModel;
    private static String[] detail_background_color;
    private static int[] natant_font_size;
    private static int video_related_font_size;
    private static String[] video_related_font_color;
    private static int video_title_font_size;
    private static String[] video_title_font_color;
    private static String[] comment_font_color;
    private static int[] comment_font_size;
    private static String[] comment_user_color;
    private static int[] comment_user_font_size;
    private static String[] sub_comment_font_color;
    private static int[] sub_comment_font_size;
    private static int[] sub_comment_background_color;
    private static int[] sub_comment_more_color;
    private static String q;

    static {
        int[] v4;
        int v3;
        int v2_1;
        int v1_1;
        int v0_2;
        String[] v2;
        String v1;
        int v9 = 4;
        int v8 = 3;
        int v5 = 2;
        DetailStyleConfig.TAG = DetailStyleConfig.class.getSimpleName();
        String v0 = AppData.getInstance().mDetailUiOption;
        if (!android.support.design.a.isTextEmpty(v0)) {
            DetailStyleConfig.q = v0;
            Logger.d(DetailStyleConfig.TAG, v0);
            Object v0_1 = GsonDependManager.getInstance().fromJson(v0, DetailStyleConfigModel.class);
            DetailStyleConfig.mDetailStyleConfigModel = ((DetailStyleConfigModel) v0_1);
            if (v0_1 != null) {

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.detail_background_color != null && DetailStyleConfig.mDetailStyleConfigModel.detail_background_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.detail_background_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.detail_background_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                    DetailStyleConfig.detail_background_color = v2;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.natant_font_size != null && DetailStyleConfig.mDetailStyleConfigModel.natant_font_size.length == v9) {
                    v0_2 = DetailStyleConfig.mDetailStyleConfigModel.natant_font_size[0];
                    v1_1 = DetailStyleConfig.mDetailStyleConfigModel.natant_font_size[1];
                    v2_1 = DetailStyleConfig.mDetailStyleConfigModel.natant_font_size[v5];
                    v3 = DetailStyleConfig.mDetailStyleConfigModel.natant_font_size[v8];
                    v4 = new int[v9];
                    v4[0] = v1_1;
                    v4[1] = v0_2;
                    v4[v5] = v2_1;
                    v4[v8] = v3;
                    DetailStyleConfig.natant_font_size = v4;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.natant_font_color != null && DetailStyleConfig.mDetailStyleConfigModel.natant_font_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.natant_font_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.natant_font_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.natant_background_color != null && DetailStyleConfig.mDetailStyleConfigModel.natant_background_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.natant_background_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.natant_background_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null) {
                    DetailStyleConfig.video_title_font_size = DetailStyleConfig.mDetailStyleConfigModel.video_title_font_size;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.video_title_font_color != null && DetailStyleConfig.mDetailStyleConfigModel.video_title_font_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.video_title_font_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.video_title_font_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                    DetailStyleConfig.video_title_font_color = v2;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null) {
                    DetailStyleConfig.video_related_font_size = DetailStyleConfig.mDetailStyleConfigModel.video_related_font_size;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.video_related_font_color != null && DetailStyleConfig.mDetailStyleConfigModel.video_related_font_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.video_related_font_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.video_related_font_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                    DetailStyleConfig.video_related_font_color = v2;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.comment_font_size != null && DetailStyleConfig.mDetailStyleConfigModel.comment_font_size.length == v9) {
                    v0_2 = DetailStyleConfig.mDetailStyleConfigModel.comment_font_size[0];
                    v1_1 = DetailStyleConfig.mDetailStyleConfigModel.comment_font_size[1];
                    v2_1 = DetailStyleConfig.mDetailStyleConfigModel.comment_font_size[v5];
                    v3 = DetailStyleConfig.mDetailStyleConfigModel.comment_font_size[v8];
                    v4 = new int[v9];
                    v4[0] = v1_1;
                    v4[1] = v0_2;
                    v4[v5] = v2_1;
                    v4[v8] = v3;
                    DetailStyleConfig.comment_font_size = v4;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.comment_font_color != null && DetailStyleConfig.mDetailStyleConfigModel.comment_font_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.comment_font_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.comment_font_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                    DetailStyleConfig.comment_font_color = v2;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.comment_user_font_size != null && DetailStyleConfig.mDetailStyleConfigModel.comment_user_font_size.length == v9) {
                    v0_2 = DetailStyleConfig.mDetailStyleConfigModel.comment_user_font_size[0];
                    v1_1 = DetailStyleConfig.mDetailStyleConfigModel.comment_user_font_size[1];
                    v2_1 = DetailStyleConfig.mDetailStyleConfigModel.comment_user_font_size[v5];
                    v3 = DetailStyleConfig.mDetailStyleConfigModel.comment_user_font_size[v8];
                    v4 = new int[v9];
                    v4[0] = v1_1;
                    v4[1] = v0_2;
                    v4[v5] = v2_1;
                    v4[v8] = v3;
                    DetailStyleConfig.comment_user_font_size = v4;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.comment_user_color != null && DetailStyleConfig.mDetailStyleConfigModel.comment_user_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.comment_user_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.comment_user_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                    DetailStyleConfig.comment_user_color = v2;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_color != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_color.length == v5) {
                    v0 = DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_color[0];
                    v1 = DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_color[1];
                    v2 = new String[v5];
                    v2[0] = v0;
                    v2[1] = v1;
                    DetailStyleConfig.sub_comment_font_color = v2;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_size != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_size.length == v9) {
                    v0_2 = DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_size[0];
                    v1_1 = DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_size[1];
                    v2_1 = DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_size[v5];
                    v3 = DetailStyleConfig.mDetailStyleConfigModel.sub_comment_font_size[v8];
                    v4 = new int[v9];
                    v4[0] = v1_1;
                    v4[1] = v0_2;
                    v4[v5] = v2_1;
                    v4[v8] = v3;
                    DetailStyleConfig.sub_comment_font_size = v4;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_user_color != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_user_color.length == v5) {
                    v0_2 = Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_user_color[0]);
                    v1_1 = Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_user_color[1]);
                    v2_1 = Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_user_color[v5]);
                    v3 = Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_user_color[v8]);
                    v4 = new int[v9];
                    v4[0] = v0_2;
                    v4[1] = v1_1;
                    v4[v5] = v2_1;
                    v4[v8] = v3;
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_more_color != null && DetailStyleConfig.mDetailStyleConfigModel.sub_comment_more_color.length == v9) {
                    try {
                        DetailStyleConfig.sub_comment_more_color = new int[]{Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_more_color[0]), Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_more_color[1]), Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_more_color[2]), Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_more_color[3])};
                    } catch (Exception v0_3) {
                        Logger.d(DetailStyleConfig.TAG, v0_3.toString());
                    }
                }

                if (DetailStyleConfig.mDetailStyleConfigModel != null) {
                    if (DetailStyleConfig.mDetailStyleConfigModel.sub_comment_background_color != null) {
                        if (DetailStyleConfig.mDetailStyleConfigModel.sub_comment_background_color.length == v9) {
                            try {
                                DetailStyleConfig.sub_comment_background_color = new int[]{Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_background_color[0]), Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_background_color[1]), Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_background_color[2]), Color.parseColor(DetailStyleConfig.mDetailStyleConfigModel.sub_comment_background_color[3])};
                            } catch (Exception v0_3) {
                                Logger.d(DetailStyleConfig.TAG, v0_3.toString());
                            }
                        }
                    }
                }
            }
        }
    }

    public DetailStyleConfig() {

    }

    public static int getVideoTitleFontSize() {
        return DetailStyleConfig.video_title_font_size;
    }

    public static int getNatantFontSize(int index) {
        return DetailStyleConfig.natant_font_size == null
                || index >= DetailStyleConfig.natant_font_size.length
                || index < 0 ? 0 : DetailStyleConfig.natant_font_size[index];
    }

    public static String getDetailBackgroundColor(boolean arg2) {
        String v0;
        if (DetailStyleConfig.detail_background_color == null || DetailStyleConfig.detail_background_color.length != 2) {
            v0 = "";
        } else if (arg2) {
            v0 = DetailStyleConfig.detail_background_color[1];
        } else {
            v0 = DetailStyleConfig.detail_background_color[0];
        }

        return v0;
    }

    public static boolean a(View view) {
        boolean v0 = false;
        if (view != null) {
            AppData.getInstance();
            boolean isNightMode = AppData.isNightMode();
            if (FeedCellStyleConfig.getCellBackgroundColor(isNightMode) != null) {
                view.setBackgroundDrawable(FeedCellStyleConfig.getCellBackgroundColor(isNightMode));
                v0 = true;
            }
        }

        return v0;
    }

    public static int b(int arg1) {
        int v0 = DetailStyleConfig.comment_font_size == null || arg1 >= DetailStyleConfig.comment_font_size.length ? 0 : DetailStyleConfig.comment_font_size[arg1];
        return v0;
    }

    public static int b() {
        return DetailStyleConfig.video_related_font_size;
    }

    public static String b(boolean arg2) {
        String v0;
        if (DetailStyleConfig.video_title_font_color == null || DetailStyleConfig.video_title_font_color.length != 2) {
            v0 = "";
        } else if (arg2) {
            v0 = DetailStyleConfig.video_title_font_color[1];
        } else {
            v0 = DetailStyleConfig.video_title_font_color[0];
        }

        return v0;
    }

    public static String getCustomStyle() {
        return DetailStyleConfig.q;
    }

    public static int c(int arg1) {
        int v0 = DetailStyleConfig.comment_user_font_size == null || arg1 >= DetailStyleConfig.comment_user_font_size.length || arg1 < 0 ? 0 : DetailStyleConfig.comment_user_font_size[arg1];
        return v0;
    }

    public static String c(boolean arg2) {
        String v0;
        if (DetailStyleConfig.video_related_font_color == null || DetailStyleConfig.video_related_font_color.length != 2) {
            v0 = "";
        } else if (arg2) {
            v0 = DetailStyleConfig.video_related_font_color[1];
        } else {
            v0 = DetailStyleConfig.video_related_font_color[0];
        }

        return v0;
    }

    public static int d(int arg1) {
        int v0 = DetailStyleConfig.sub_comment_font_size == null || arg1 < 0 || arg1 >= DetailStyleConfig.sub_comment_font_size.length ? 0 : DetailStyleConfig.sub_comment_font_size[arg1];
        return v0;
    }

    public static String d(boolean arg2) {
        String v0;
        if (DetailStyleConfig.comment_font_color == null || DetailStyleConfig.comment_font_color.length != 2) {
            v0 = "";
        } else if (arg2) {
            v0 = DetailStyleConfig.comment_font_color[1];
        } else {
            v0 = DetailStyleConfig.comment_font_color[0];
        }

        return v0;
    }

    public static String e(boolean arg2) {
        String v0;
        if (DetailStyleConfig.comment_user_color == null || DetailStyleConfig.comment_user_color.length != 2) {
            v0 = "";
        } else if (arg2) {
            v0 = DetailStyleConfig.comment_user_color[1];
        } else {
            v0 = DetailStyleConfig.comment_user_color[0];
        }

        return v0;
    }

    public static String f(boolean arg2) {
        String v0;
        if (DetailStyleConfig.sub_comment_font_color == null || DetailStyleConfig.sub_comment_font_color.length != 2) {
            v0 = "";
        } else if (arg2) {
            v0 = DetailStyleConfig.sub_comment_font_color[1];
        } else {
            v0 = DetailStyleConfig.sub_comment_font_color[0];
        }

        return v0;
    }

    public static ColorStateList g(boolean arg7) {
        ColorStateList v0;
        int[][] v2;
        int[] v1;
        int v6 = -16842919;
        int v5 = 2;
        if (DetailStyleConfig.sub_comment_more_color == null || DetailStyleConfig.sub_comment_more_color.length != 4) {
            v0 = null;
        } else if (arg7) {
            v1 = new int[v5];
            v1[0] = DetailStyleConfig.sub_comment_more_color[3];
            v1[1] = DetailStyleConfig.sub_comment_more_color[1];
            v2 = new int[v5][];
            v2[0] = new int[]{v6};
            v2[1] = new int[0];
            v0 = new ColorStateList(v2, v1);
        } else {
            v1 = new int[v5];
            v1[0] = DetailStyleConfig.sub_comment_more_color[v5];
            v1[1] = DetailStyleConfig.sub_comment_more_color[0];
            v2 = new int[v5][];
            v2[0] = new int[]{v6};
            v2[1] = new int[0];
            v0 = new ColorStateList(v2, v1);
        }

        return v0;
    }

    public static StateListDrawable h(boolean arg6) {
        StateListDrawable v0;
        int v3 = 16842919;
        int v4 = 3;
        if (DetailStyleConfig.sub_comment_background_color == null || DetailStyleConfig.sub_comment_background_color.length != 4) {
            v0 = null;
        } else {
            v0 = new StateListDrawable();
            if (arg6) {
                v0.addState(new int[]{v3}, new ColorDrawable(DetailStyleConfig.sub_comment_background_color[v4]));
                v0.addState(new int[0], new ColorDrawable(DetailStyleConfig.sub_comment_background_color[v4]));
            } else {
                v0.addState(new int[]{v3}, new ColorDrawable(DetailStyleConfig.sub_comment_background_color[2]));
                v0.addState(new int[0], new ColorDrawable(DetailStyleConfig.sub_comment_background_color[0]));
            }
        }

        return v0;
    }
}

